package com.qihetimes.earthangel.controller;

import com.qihetimes.earthangel.common.ResponseResult;
import com.qihetimes.earthangel.model.Banner;
import com.qihetimes.earthangel.service.IBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * Banner控制器
 *
 * @author ：f4cklangzi@gmail.com
 * @date ：Created At 2022/1/3
 */
@Slf4j
@Api(tags = "轮播图模块")
@RestController
@RequestMapping("/api/banner")
public class BannerController {
    
    @Resource
    private IBannerService bannerService;
    
    @ApiOperation(value = "轮播图列表")
    @GetMapping("/list")
    public ResponseResult<List<Banner>> list() {
        List<Banner> res = bannerService.lambdaQuery().orderByAsc(Banner::getSort).list();
        return ResponseResult.success(res);
    }
}
